package com.sniff.atp.utils;

import com.sniff.atp.dto.ClientLoginDTO;
import com.sniff.atp.dto.DKLoginDTO;
import com.sniff.atp.dto.SystemLoginDTO;
import com.sniff.atp.dto.WMSLoginDTO;

import java.util.HashMap;
import java.util.Map;

public class Headers {

    private Headers(){}
    private static final String TOKEN = "X-AuthToken";


    /**
     * client端发起请求的带上鉴权header
     */
    public static Map<String, String> setClientHeader(ClientLoginDTO clientLoginDTO) {
        Map<String, String> header = new HashMap<>();
        if(clientLoginDTO.getShopId() != null && !"null".equals(clientLoginDTO.getShopId())){
            header.put("X-AuthShopId", clientLoginDTO.getShopId());
        }
        header.put(TOKEN, clientLoginDTO.getToken());
        return header;
    }

    /**
     * system: 平台端发起请求的带上鉴权header
     */
    public static Map<String, String> setSystemHeader(SystemLoginDTO systemLoginDTO) {
        Map<String, String> header = new HashMap<>();
        header.put(TOKEN, systemLoginDTO.getToken());
        return header;
    }

    public static Map<String, String> setXXLHeader(String cookie) {
        Map<String, String> header = new HashMap<>();
        header.put("Cookie", cookie);
        return header;
    }

    /**
     * wms: wms仓库端发起请求鉴权header
     */
    public static Map<String, String> setWmsHeader(WMSLoginDTO wmsLoginDTO){
        HashMap<String, String> header = new HashMap<>();
        header.put(TOKEN, wmsLoginDTO.getToken());
        return header;
    }

    /**
     * 小程序: 档口小程序发起请求鉴权header
     */
    public static Map<String, String> setDKHeader(DKLoginDTO dkLoginDTO){
        HashMap<String, String> header = new HashMap<>();
        header.put(TOKEN, dkLoginDTO.getToken());
        return header;
    }
}
